package com.ruoyi.system.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TrafficRecordMapper;
import com.ruoyi.system.domain.TrafficRecord;
import com.ruoyi.system.service.ITrafficRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 通行关联详细Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-10-29
 */
@Service
public class TrafficRecordServiceImpl implements ITrafficRecordService 
{
    @Autowired
    private TrafficRecordMapper trafficRecordMapper;

    /**
     * 查询通行关联详细
     * 
     * @param trId 通行关联详细主键
     * @return 通行关联详细
     */
    @Override
    public TrafficRecord selectTrafficRecordByTrId(Long trId)
    {
        return trafficRecordMapper.selectTrafficRecordByTrId(trId);
    }

    @Override
    public TrafficRecord selectByUserId(String dtmsContacts) {
        return trafficRecordMapper.selectByUserId(dtmsContacts);
    }

    /**
     * 查询通行关联详细列表
     * 
     * @param trafficRecord 通行关联详细
     * @return 通行关联详细
     */
    @Override
    public List<TrafficRecord> selectTrafficRecordList(TrafficRecord trafficRecord)
    {
        return trafficRecordMapper.selectTrafficRecordList(trafficRecord);
    }

    /**
     * 新增通行关联详细
     * 
     * @param trafficRecord 通行关联详细
     * @return 结果
     */
    @Override
    public int insertTrafficRecord(TrafficRecord trafficRecord)
    {
        return trafficRecordMapper.insertTrafficRecord(trafficRecord);
    }

    /**
     * 修改通行关联详细
     * 
     * @param trafficRecord 通行关联详细
     * @return 结果
     */
    @Override
    public int updateTrafficRecord(TrafficRecord trafficRecord)
    {
        return trafficRecordMapper.updateTrafficRecord(trafficRecord);
    }

    /**
     * 批量删除通行关联详细
     * 
     * @param trIds 需要删除的通行关联详细主键
     * @return 结果
     */
    @Override
    public int deleteTrafficRecordByTrIds(String trIds)
    {
        return trafficRecordMapper.deleteTrafficRecordByTrIds(Convert.toStrArray(trIds));
    }

    /**
     * 删除通行关联详细信息
     * 
     * @param trId 通行关联详细主键
     * @return 结果
     */
    @Override
    public int deleteTrafficRecordByTrId(Long trId)
    {
        return trafficRecordMapper.deleteTrafficRecordByTrId(trId);
    }

    @Override
    public TrafficRecord getUserDoseValueByUserId(String dtmsContacts) {
        return trafficRecordMapper.getUserDoseValueByUserId(dtmsContacts);
    }

    @Override
    public void getAllOnline(Integer pageNumber, Integer lines, HashMap<String, Object> hs) {
        pageNumber =  null == pageNumber ? 0 : pageNumber;
        lines = null == lines ? 0 : lines;
        List<TrafficRecord> list = trafficRecordMapper.getAllOnline(pageNumber,lines);
        Long count = trafficRecordMapper.getCount();
        hs.put("DBList", list);
        hs.put("DBAccount", count);
    }

    @Override
    public void getAllOrders(HashMap<String, Object> hs) {
        List<TrafficRecord> list = trafficRecordMapper.getAllOrders();
        Long count = trafficRecordMapper.getCount();
        hs.put("DBList", list);
        hs.put("DBAccount", count);
    }

    @Override
    public List<TrafficRecord> getOrderInfo(int tr_id, HashMap<String, Object> hs) {
        return trafficRecordMapper.getOrderInfo(tr_id);
    }
}
